package com.turing.post.organization.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * @凭证状态迁移明细
 * @author zxl
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "VOUCHERORDERACTIONDETAIL")
@IdClass(VoucherOrderActionDetail.class)
public class VoucherOrderActionDetail implements Serializable {

	/**
	 * 操作类型 调拨单创建
	 */
	public static final String ACTIONTYPE_0 = "0";
	/**
	 * 调出确认
	 */
	public static final String ACTIONTYPE_1= "1";
	/**
	 * 接收
	 */
	public static final String ACTIONTYPE_2 = "2";
	/**
	 * 接收确认
	 */
	public static final String ACTIONTYPE_3 = "3";

	/**
	 * 拒绝
	 */
	public static final String ACTIONTYPE_4 = "4";
	/**
	 * 拒绝确认
	 */
	public static final String ACTIONTYPE_5 = "5";


	/**
	 * 调拨单ID
	 */
	private BigInteger transferOrderId;
	/**
	 * 操作时间
	 */
	private Date actionTime;
	/**
	 * 操作员ID
	 */
	private BigInteger operId;
	/**
	 * 初始状态
	 */
	private String initialStatus;
	/**
	 * 结束状态
	 */
	private String endStatus;
	/**
	 * 操作类型
	 */
	private String actionType;
	/**
	 * 备注
	 */
	private String remark;

	public VoucherOrderActionDetail() {
		super();
	}

	@Id
	@Column(name = "TRANSFERORDERID", nullable = false)
	public BigInteger getTransferOrderId() {
		return transferOrderId;
	}

	public void setTransferOrderId(BigInteger transferOrderId) {
		this.transferOrderId = transferOrderId;
	}

	@Id
	@Column(name = "ACTIONTIME", nullable = false)
	public Date getActionTime() {
		return actionTime;
	}

	public void setActionTime(Date actionTime) {
		this.actionTime = actionTime;
	}

	@Column(name = "OPERID", nullable = false)
	public BigInteger getOperId() {
		return operId;
	}

	public void setOperId(BigInteger operId) {
		this.operId = operId;
	}

	@Column(name = "INITIALSTATUS")
	public String getInitialStatus() {
		return initialStatus;
	}

	public void setInitialStatus(String initialStatus) {
		this.initialStatus = initialStatus;
	}

	@Column(name = "ENDSTATUS", nullable = false)
	public String getEndStatus() {
		return endStatus;
	}

	public void setEndStatus(String endStatus) {
		this.endStatus = endStatus;
	}

	@Column(name = "ACTIONTYPE", nullable = false)
	public String getActionType() {
		return actionType;
	}

	public void setActionType(String actionType) {
		this.actionType = actionType;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((this.getActionTime() == null) ? 0 : this.getActionTime()
						.hashCode());
		result = prime
				* result
				+ ((this.getTransferOrderId() == null) ? 0 : this.getTransferOrderId()
						.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final VoucherOrderActionDetail other = (VoucherOrderActionDetail) obj;
		if (this.getActionTime() == null) {
			if (other.getActionTime() != null)
				return false;
		} else if (!this.getActionTime().equals(other.getActionTime()))
			return false;
		if (this.getTransferOrderId() == null) {
			if (other.getTransferOrderId() != null)
				return false;
		} else if (!this.getTransferOrderId().equals(other.getTransferOrderId()))
			return false;
		return true;
	}
}
